﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using AnimEditor.Picture;
using AnimEditor.Define;
using AnimEditor.Anim;
using AnimEditor.Tile;
using AnimEditor.Physics;

namespace AnimEditor
{
	public class ShapePanel : Panel
	{

		int mShowTileIndex=-1;
		public int ShowTileIndex
		{
			get { return mShowTileIndex; }
			set { mShowTileIndex = value; }
		}

		protected override void OnPaint(PaintEventArgs e)
		{
			int vscorllvalue = this.VerticalScroll.Value;
			int hscorllvalue = this.HorizontalScroll.Value;

			Bitmap bmp = new Bitmap(this.Width, this.Height);
			Graphics g = Graphics.FromImage(bmp);


			if (PicMgr.Instance.BitMap != null && mShowTileIndex != -1)
			{
				Rectangle SourceRect = TileMgr.Instance.Tile_Sprites[mShowTileIndex].Rect;
				g.DrawImage(PicMgr.Instance.BitMap, new Rectangle(0, 0, SourceRect.Width, SourceRect.Height), SourceRect, GraphicsUnit.Pixel);
			}

			this.CreateGraphics().DrawImage(bmp, 0, 0);
			base.OnPaint(e);
		}
	}
}
